package dujiu.luogu.circulation;

import java.util.Arrays;
import java.util.Scanner;

public class P5724 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        // 表示整数个数
        int n = scanner.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
        }
        scanner.close();
        Arrays.sort(arr);
        // 极差
        System.out.println(arr[arr.length-1] - arr[0]);
    }
}
